package mBeanControl.client;

import mBeanControl.connection.ConnectionFactory;
import mBeanControl.exceptions.ObjectNotFoundException;
import mBeanControl.interfaces.IDomain;
import mBeanControl.interfaces.IJMSDestination;
import mBeanControl.interfaces.IJMSServer;
import mBeanControl.interfaces.IServer;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String hostname = "localhost";
		String portString = "7001";
		String username = "weblogic";
		String password = "weblogic";
		
		IDomain dr = ConnectionFactory.Connect(hostname, portString, username, password);
		
		try {
			for(IServer server :dr.getIServers()){
				System.out.println(server.getName());
				System.out.println(server.getState());
				System.out.println(server.getOpenSocketsCurrentCount());
//			System.out.println(server.getIServerConfiguration().getAcceptBacklog());
				System.out.println(server.getIJVMRuntime().getHeapSizeCurrent());
				System.out.println(server.getIThreads().getExecuteThreadIdleCount());
				System.out.println(server.getIThreads().getPendingUserRequestCount());
				System.out.println("----------------------------------------");
				for(IJMSServer jMSServer : server.getIJMSServers()){
					System.out.println("JMSServer name: " + jMSServer.getName());
					for(IJMSDestination dest: jMSServer.getIJMSDestinations()){

						System.out.println("Destination: " + dest.getName());
						System.out.println("Messages High Count: " + dest.getMessagesHighCount());
						System.out.println("Messages Current Count: "+ dest.getMessagesCurrentCount());
						System.out.println("Consumers Total Count: "+dest.getConsumersTotalCount() );
						System.out.println("Messages Pending Count:"+ dest.getMessagesPendingCount());
					}
					System.out.println("***********************************");
				}
					
			}
		} catch (ObjectNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
